﻿using System;

namespace PropertyExpression.ControllableQuery.Toolkit.Test.Queries
{
    public interface IError2QueryInfo
    {
        Guid PublicationId { get; }
        string ModelCode { get; }
        string ModelSequence { get; }
    }

    public class Error2Query : IQuery<IError2QueryInfo>
    {
        private readonly IParam<string> modelCode;

        public Error2Query(IParam<string> modelCode)
        {
            this.modelCode = modelCode;
        }

        public string TransformText()
        {
            return
@"SELECT
    ModelPublication.PublicationId,
    ModelPublication.ModelCode,
    ModelPublication.ModelSequence
FROM
    ModelPublication
WHERE
    ModelPublication.ModelCode = " + modelCode + @"
    AND ModelPublication.ModelCode = " + modelCode;
        }
    }

    public class Error2FixQuery : IQuery<IError2QueryInfo>
    {
        private readonly ISqlParam<string> modelCode;

        public Error2FixQuery(IParam<string> modelCode)
        {
            this.modelCode = modelCode.GenerateSqlParam();
        }

        public string TransformText()
        {
            return
@"SELECT
    ModelPublication.PublicationId,
    ModelPublication.ModelCode,
    ModelPublication.ModelSequence
FROM
    ModelPublication
WHERE
    ModelPublication.ModelCode = " + modelCode + @"
    AND ModelPublication.ModelCode = " + modelCode;
        }
    }
}
